using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using KnowledgeEntity;

namespace MVC3Demo.Controllers
{
   public class CategoryController : Controller
   {
      public ActionResult Index()
      {
         return View();
      }

      public ActionResult ShowCategory(int categoryID)
      {
         Dictionary<int, Category> list = Category.GetAllCategories();

         if (!list.ContainsKey(categoryID))
            return Redirect("Error.aspx");

         ViewData["rootCategory"] = list[categoryID];
         return View("ShowCategory");
      }
   }
}